/**
////////////////////////////////////////////////////////////////////////////////
//                                                                            // 
//  Copyright (c) 2013 Santiago Benito Rebollo. Eclipse Public License - v 1.0//
//  @author Santiago Benito Rebollo.                                          // 
//  santiago.benito.rebollo@gmail.com                                         //
//                                                                            //  
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC// 
// LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM//
// CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.                      //
//                                                                            //
// A Contributor may choose to distribute the Program in object code form     //
// under its own license agreement, provided that:                            //
//                                                                            //
// a) it complies with the terms and conditions of this Agreement; and        //
// b) its license agreement:                                                  //
//                                                                            //
// i) effectively disclaims on behalf of all Contributors all warranties and  //
// conditions, express and implied, including warranties or conditions of     //  
// title and non-infringement, and implied warranties or conditions of        //
// merchantability and fitness for a particular purpose;                      //
// ii) effectively excludes on behalf of all Contributors all liability for   //
// damages, including direct, indirect, special, incidental and consequential //
// damages, such as lost profits;                                             //
// iii) states that any provisions which differ from this Agreement are       //
// offered by that Contributor alone and not by any other party; and          //
// iv) states that source code for the Program is available from such         //
// Contributor, and informs licensees how to obtain it in a reasonable        //
// manner on or through a medium customarily used for software exchange.      //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
 */

package com.chago.fastrecado;

import java.util.NoSuchElementException;

/**
<p>Defines the different actions to be considered in case of exceptions. The
exceptions are thrown using the class {@link com.chago.FastRecadoException}. 
The error code (integer values) used in this exception
@author <a href="santiago.benito.rebollo@gmail.com">Santiago Benito Rebollo</a>
@version $Revision: 1.0 $
@invariant $none
 */
public final class ErrorCode {

    /**
    Default error code (value -100), if no other behavior is specified we use this error code as default value.<br>
    <b>Note:</b> In this project the error code just gives information about what action to take for handling the error 
    In general all errors will have the same action, that is why we define this default error code.
     */
    public static final int _DEFAULT = - 100;

    /**
    The error will behave on client size as a warning signal (value 100)
     */
    public static final int _WARNING = 100;

    /**
    Check if the input <code>code</code> corresponds to any code defined on this class.
    @param code A possible code defined on this class.
    @return <code>true</code> if the input argument correspond with any error code previously defined on this class.
    @throws java.util.NoSuchElementException If the input <code>code</code> doesn't correspond with any code defined on this class.
    @since 1.1
    @post $none
    */
    public final static boolean exist(int code) {
        boolean result = false;
        if ((code == _DEFAULT) || (code == _WARNING)) {
            result = true;
        } else {
            throw new NoSuchElementException(Integer.toString(code));
        }
        return result;
    }

    /**
    Default constructor, it does nothing, we provide it for avoiding creation of public instance.
    @post $none
     */
    private ErrorCode() {

    }
}

